// src\routes\index.js
// 统一管理路由
import { Navigate } from "react-router-dom";
// 引入需要的组件
import About from "../pages/About";
import Home from "../pages/Home";
import Message from "../pages/Message";
import News from "../pages/News";
import Detail from "../pages/Detail";
import Detail1 from "../pages/Detail1";
import Detail2 from "../pages/Detail2";
const routes = [
    // 路由表
    {
        path: "/about",
        element: <About />
    },
    {
        path: "/home",
        element: <Home />,
        children: [
            {
                path: "news",
                element: <News />,

            },
            {
                path: "message",
                element: <Message />,
                children:[
                    {
                        path:'detail/:id/:title/:content',//params传参
                        element:<Detail/>
                    },
                    {
                        path:'detail1',
                        element:<Detail1/>
                    },
                    {
                        path:'detail2',
                        element:<Detail2/>
                    }
                ]
            },
        ]
    },
    {
        // 重定向
        path: "/",
        element: <Navigate to='/about' />
    },
]
export default routes